package com.itheima.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @author 16778
 * @version 1.0
 * @date 2025/9/23 15:54
 */
@Slf4j
@Component
@Aspect
public class MyAspect1 {

//    @Pointcut("execution(* com.itheima.service.DeptService.*(..))")
    public void cut(){

    }

//    @Before("execution(* com.itheima.service.DeptService.*(..))")
//    @Before("cut()")
    public void before(){
        log.info("before....");
    }

//    @Around("execution(* com.itheima.service.DeptService.*(..))")
//    @Around("cut()")
    public Object around(ProceedingJoinPoint pjp) throws Throwable {
        log.info("around...before....");

        Object res = pjp.proceed();

        log.info("around...after");

        return res;
    }

//    @After("execution(* com.itheima.service.DeptService.*(..))")
//    @After("cut()")
    public void after(){
        log.info("after...");
    }

//    @AfterReturning("execution(* com.itheima.service.DeptService.*(..))")
//    @AfterReturning("cut()")
    public void afterReturning(){
        log.info("afterReturn....");
    }

//    @AfterThrowing("execution(* com.itheima.service.DeptService.*(..))")
//    @AfterThrowing("cut()")
    public void afterThrowing(){
        log.info("afterThrowing");
    }

}
